If you want to host LeadPilot on your VPS with a custom domain and SSL, this guide will walk you through the entire setup in two parts:
- Installing Node.js, PM2 & LeadPilot
- Configuring Domain, Nginx & SSL
By the end, your app will be live on https://yourdomain.com
with auto-renewing SSL. π
Prerequisites
- A VPS (Ubuntu 22 or 24 works fine).
- Root access to your server.
- A domain name pointing to your VPS IP.
π» Purchase VPS & Get 15% Instant Discount:
Claim Offer
ποΈ Coupon Code: Rajeevdaz15
β‘ Step 1: Install Node.js, PM2 & LeadPilot
Run the following script in your VPS terminal. This will:
- Update system packages
- Install required libraries
- Install Node.js v18
- Install PM2 process manager
- Clone LeadPilot
- Start the app with PM2
# Step 2: Update
apt update && apt upgrade -y
# Step 3: System Libraries
apt install -y \
libasound2t64 libatk-bridge2.0-0t64 libatk1.0-0t64 \
libcups2t64 libdrm2 libgbm1 libgtk-3-0t64 libnss3 \
libx11-xcb1 libxcomposite1 libxdamage1 libxrandr2 \
libpangocairo-1.0-0 libpangoft2-1.0-0
# Step 4: Node.js
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt install -y nodejs
node -v && npm -v
# Step 5: PM2
npm install -g pm2
# Step 6: Clone LeadPilot
git clone https://github.com/rajeevdaz/leadpilot.git
cd leadpilot
# Step 7: Install Dependencies
npm install
# Step 8: SKIP - No environment variables needed!
# Step 9: Start with PM2
pm2 start server.js --name leadpilot
pm2 save
pm2 startup
β‘ Step 2: Configure Domain & SSL
Now weβll configure Nginx as a reverse proxy and install a free SSL certificate with Letβs Encrypt.
#!/bin/bash
# === CONFIG ===
DOMAIN="yourdomain.com" # <-- replace with your domain
EMAIL="your@email.com" # <-- replace with real email
APP_NAME="leadpilot"
APP_DIR="/root/leadpilot" # <-- path to Node.js project
APP_PORT=3000 # <-- port your app listens on
APP_FILE="server.js" # <-- Node.js entry file
# === Install dependencies ===
echo "π¦ Installing Nginx & Certbot..."
apt update -y
apt install -y nginx certbot python3-certbot-nginx
# === Setup Nginx reverse proxy ===
NGINX_CONF="/etc/nginx/sites-available/$APP_NAME"
echo "βοΈ Creating Nginx config for $DOMAIN ..."
cat > $NGINX_CONF <<EOL
server {
listen 80;
server_name $DOMAIN;
location / {
proxy_pass http://localhost:$APP_PORT;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host \$host;
proxy_cache_bypass \$http_upgrade;
}
}
EOL
ln -sf $NGINX_CONF /etc/nginx/sites-enabled/$APP_NAME
nginx -t && systemctl reload nginx
# === Issue SSL Certificate ===
echo "π Requesting SSL certificate from Let's Encrypt ..."
certbot --nginx -d $DOMAIN --non-interactive --agree-tos -m $EMAIL || true
# === Setup PM2 App ===
echo "π Configuring PM2..."
cd $APP_DIR
pm2 restart $APP_FILE --name $APP_NAME || pm2 start $APP_FILE --name $APP_NAME
pm2 save
pm2 startup systemd -u root --hp /root
# === Enable SSL Auto-Renew (systemd timer) ===
echo "β³ Enabling SSL auto-renew..."
systemctl enable certbot.timer
systemctl start certbot.timer
# === Finish ===
echo "β
Setup complete!"
echo "Your app should be live at: https://$DOMAIN"
echo "SSL auto-renew is handled by certbot.timer (runs twice daily)."
π Final Result
- Your LeadPilot app is now available at
https://yourdomain.com
- SSL certificates auto-renew automatically.
- PM2 ensures your app stays alive even after reboot.